#include <Arduino.h>

// put function declarations here:
int red_pin = 6;
int green_pin = 5;
int blue_pin = 3;
int red_val = 0;
int green_val = 0;
int blue_val = 600;
int i = 0;

void setup()
{
  // put your setup code here, to run once:
  pinMode(red_pin, OUTPUT);
  pinMode(green_pin, OUTPUT);
  pinMode(blue_pin, OUTPUT);

  pinMode(red_val, INPUT);
  pinMode(green_val, INPUT);
  pinMode(blue_val, INPUT);

  Serial.begin(9600);
}

void loop()
{
  // put your main code here, to run repeatedly:

  if (i < 200)
  {
    red_val++;
    green_val = 0;
    blue_val--;
  }
  else if (i < 400)
  {
    red_val--;
    green_val++;
    blue_val = 0;
  }
  else if (i < 600)
  {
    red_val = 0;
    green_val--;
    blue_val++;
  }
  else
  {
    i = 0;
  }
  i++;

  analogWrite(red_pin, red_val);
  analogWrite(green_pin, green_val);
  analogWrite(blue_pin, blue_val);

  Serial.print("i:");
  Serial.print(i,DEC);
  Serial.print("\tr:");
  Serial.print(red_val,DEC);
  Serial.print("\tg:");
  Serial.print(green_val,DEC);
  Serial.print("\tb:");
  Serial.println(blue_val,DEC);
}

// put function definitions here: